package com.bjpowernode.service.impl;

import com.bjpowernode.entity.Economics;
import com.bjpowernode.mapper.EconomicsMapper;
import com.bjpowernode.service.EconomicsService;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class EconomicsServiceImpl implements EconomicsService {

    /**
     * 访问收支记录数据
     */
    private EconomicsMapper economicsMapper;

    @Override
    public void insertEconomics(Economics economics) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        economics.setDate(dateFormat.format(new Date()));

        this.economicsMapper.insertEconomics(economics);
    }

    @Override
    public List<Economics> selectAllEconomics() {
        return this.economicsMapper.selectAllEconomics();
    }

    @Override
    public void deleteEconomicsById(Integer id) {
        this.economicsMapper.deleteEconomicsById(id);
    }

    public EconomicsMapper getEconomicsMapper() {
        return economicsMapper;
    }

    public void setEconomicsMapper(EconomicsMapper economicsMapper) {
        this.economicsMapper = economicsMapper;
    }
}
